/**
 * 
 */
package com.kunbo.cn.controller.core.handset;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kunbo.cn.entity.core.handset.HandsetUsers;
import com.kunbo.cn.service.core.handset.HandsetUsersService;
import com.kunbo.cn.util.retu.CommonResult;

/**
 *手持机用户管理
 * @author bjl  
 * @date 2019年3月17日 
 */
@RestController
@RequestMapping("/Handset/")
public class HandsetUsersController {
	@Autowired
	private JdbcTemplate jdbc;
	@Autowired
	private HandsetUsersService Hanservice;
	/**
	 * 添加手持机用户
	 * 
	 */
	@PostMapping("/add")
	public CommonResult add(HandsetUsers cuser,HttpServletRequest request) {
		Hanservice.save(cuser);
		return new CommonResult(true,"操作成功",null);
	}
		/**
		 * 
		 * 修改
		 */
		@PutMapping("/update")
		public CommonResult update(HandsetUsers cuser) {
			Hanservice.update(cuser);
			return new CommonResult(true,"操作成功",null);
		}
		
		@DeleteMapping("/delete")
		public CommonResult delete(String id) {
			Hanservice.delete(id);
			return new CommonResult(true,"操作成功",null);
		}
		/**
		 * 详情
		 * 
		 */
		@GetMapping("/findById")
		public HandsetUsers findById(String id) {
			HandsetUsers d = Hanservice.findById(id);
			return d;
		}
		
		/**
		 *条件分页查询
		 * 
		 */
		@GetMapping("/findHandsetUsers")
		public Page<HandsetUsers> findHandsetUsers(String handuser_code,String name,String account,Integer pageNo,Integer pageSize) {
			Page<HandsetUsers> page = Hanservice.findHandsetUsers(handuser_code, name,account,pageNo, pageSize);
			return page;
		}
	
}
